package net.obxlabs.tweetpad;

import processing.core.*;

public class Thumbnail {
	private Sketchpad p;
	private PImage image;
	private int color;
	
	public Thumbnail(Sketchpad p, String filePath, int[] c) throws NullPointerException {
		this.p = p;
		color = p.color(c[0], c[1], c[2]);
		image = p.loadImage(filePath);
		if (image == null) {
			throw new NullPointerException();
		}
	}
	
	public void draw(float x, float y) {
		p.image(image, x, y, Tweet.THUMB_SIZE, Tweet.THUMB_SIZE);
		p.stroke(color);
		p.strokeWeight(2);
		p.noFill();
		p.rect(x, y, Tweet.THUMB_SIZE, Tweet.THUMB_SIZE);
		p.strokeWeight(1);
	}
}
